const INFO_KEY = 'user_info'
const HISTORY_KEY = 'history_key'

export const getUserInfo = () => {
  const obj = localStorage.getItem(INFO_KEY)
  return obj ? JSON.parse(obj) : {}
}

export const setUserInfo = (obj) => {
  localStorage.setItem(INFO_KEY, JSON.stringify(obj))
}

export const removeUserInfo = () => {
  localStorage.removeItem(INFO_KEY)
}

export const getHistory = () => {
  const obj = localStorage.getItem(HISTORY_KEY)
  return obj ? JSON.parse(obj) : {}
}

export const setHistory = (obj) => {
  localStorage.setItem(HISTORY_KEY, JSON.stringify(obj))
}

export const removeHistory = () => {
  localStorage.removeItem(HISTORY_KEY)
}
